import React, { Component } from "react";

import Modal from "./Modal";

class App extends Component {
  state = {
    show: false,
  };
  open = () => {
    this.setState({
      show: true,
    });
  };
  onOk = () => {
    this.setState({
      show: false,
    });
  };
  onCancel = () => {
    this.setState({
      show: false,
    });
  };
  render() {
    return (
      <>
        <h2>对话框组件</h2>
        <button onClick={this.open}>打开</button>
        <Modal
          open={this.state.show}
          title="Basic Modal"
          onOk={this.onOk}
          onCancel={this.onCancel}
          cancelText="关闭"
          okText="发送"
          width="400"
        >
          <p>Some contents...</p>
          <p>Some contents...</p>
          <p>Some contents...</p>
        </Modal>
      </>
    );
  }
}

export default App;
